const { valid } = require("mockjs");

const userInfo = {
  userId: "123456",
  role: "employee",
  avatar: "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif"
};

const validateCode = {
  validatCode: "123456"
};

const login = {
  msg: "登录成功",
  token: "AEb7bFcE-d8BD-4cf1-FFF4-41F842dA1907",
  userInfo: {
    userId: "123456",
    role: "employee",
    avatar:
      "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif"
  }
};

const logout = {
  msg: "注销成功"
};

const register = {
  msg: "注册成功"
};

const retrievepwd = {
  msg: "找回密码",
  phone: "13978906789"
};

const setNewPwd = {
  msg: "设置新密码成功"
};

module.exports = [
  //获取用户信息
  {
    url: "/user/getUserInfo",
    type: "get",
    result: () => {
      return {
        code: 200,
        data: {userInfo}
      };
    }
  },
  //获取验证码
  {
    url: "/user/getValidateCode",
    type: "get",
    result: () => {
      return {
        code: 200,
        data: validateCode
      };
    }
  },
  //注册
  {
    url: "/user/register",
    type: "post",
    result: () => {
      return {
        code: 200,
        data: register
      };
    }
  },
  //登录
  {
    url: "/user/login",
    type: "post",
    result: () => {
      return {
        code: 200,
        data: login
      };
    }
  },
  //找回密码
  {
    url: "/user/retrievePwd",
    type: "post",
    result: () => {
      return {
        code: 200,
        data: retrievepwd
      };
    }
  },
  //设置新密码
  {
    url: "/user/setNewPwd",
    type: "post",
    result: () => {
      return {
        code: 200,
        data: setNewPwd
      };
    }
  },
  //注销账户
  {
    url: "/user/logout",
    type: "post",
    result: () => {
      return {
        code: 200,
        data: logout
      };
    }
  }
];